﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DingApi.Models;


using System.Web;
using Dingding.Helper;



namespace DingApi.Controllers
{
    public class Kszz91Controller : ApiController
    {


        public System.Data.DataSet GetAllKszz91()
        {
            EI.EIInfo inBlock = new EI.EIInfo();
            

            EI.EIInfo outBlock = EI.EITuxedo.CallService("pa_index_91", inBlock);



            //调整为初始用户肥胖数据；（之前为最新用户的）
            /*outBlock.Tables[0].Rows.Clear();

            
            for (int i = 0; i < outBlock.Tables[2].Rows.Count; i++)
            {
                outBlock.Tables[0].Rows.Add();
                outBlock.Tables[0].Rows[i]["NAME"] = outBlock.Tables[2].Rows[i]["NAME"];
                outBlock.Tables[0].Rows[i]["VALUE"] = outBlock.Tables[2].Rows[i]["VALUE_PRE"];
            }
             * */


            outBlock.Tables[0].TableName = "data_pie1";
            outBlock.Tables[0].Columns[0].ColumnName = "value"; //饼图，好像必须为value 才行；
            outBlock.Tables[0].Columns[1].ColumnName = "name"; //饼图，好像必须为name 才行；





           
            outBlock.Tables[1].TableName = "data_pie2";
            outBlock.Tables[1].Columns[0].ColumnName = "value"; //饼图，好像必须为value 才行；
            outBlock.Tables[1].Columns[1].ColumnName = "name"; //饼图，好像必须为name 才行；



            outBlock.Tables[4].TableName = "data_line";
           

            return outBlock;
        }


        public System.Data.DataSet PostAllKszz91()
        {

            EI.EIInfo inBlock = new EI.EIInfo();
            inBlock.Tables[0].Columns.Add("WEIXIN_NO");

            inBlock.Tables[0].Rows.Add();
            inBlock.sys_info.company_code = "KS";
            inBlock.Tables[0].Rows[0]["WEIXIN_NO"] = "ooveSs7m1W053QqHY2myppykqcaY";


            EI.EIInfo outBlock = EI.EITuxedo.CallService("kssub1_inq_rp2", inBlock);
            //if (outBlock.sys_info.flag != 0)
            //{
            //    return outBlock;
            //}
            //if (outBlock.Tables[0].Rows.Count < 1)
            //{
            //    return outBlock;           
            //}



            string sql_str0 = "select 235  value ,'视频广告' name from dual   ";
            sql_str0 += "union all select 274  value ,'联盟广告' name from dual ";
            sql_str0 += "union all select 310  value ,'邮件营销' name from dual ";
            sql_str0 += "union all select 335  value ,'直接访问' name from dual ";
            sql_str0 += "union all select 400  value ,'搜索引擎' name from dual ";


            outBlock = EF.Utility.ExecQuery(sql_str0);
            outBlock.Tables[0].TableName = "data_pie";

            return outBlock;












        }

    }
}